package com.xyw.his00.controller;

import com.xyw.his00.anno.OptionLog;
import com.xyw.his00.entity.ResponseData;
import com.xyw.his00.mapper.OrderMapper;
import com.xyw.his00.pojo.dbpojo.PayOrder;
import com.xyw.his00.utils.NumberUtils.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/payOrder/")
public class PayOrderController {
    @Autowired
    private OrderMapper orderMapper;
    @OptionLog
    @RequestMapping("payChecks")
    public ResponseData payChecks(PayOrder order){
        if(order!=null){
            orderMapper.insert(order);
            return ResponseData.SUCCESS;
        }
      return ResponseData.FAIL;
    }
    @OptionLog
    @RequestMapping("payInspections")
    public ResponseData payInspections(PayOrder order){
        if(order!=null){
            orderMapper.insert(order);
            return ResponseData.SUCCESS;
        }
        return ResponseData.FAIL;
    }
    @OptionLog
    @RequestMapping("payDisposal")
    public ResponseData payDisposal(PayOrder order){
        if(order!=null){
            orderMapper.insert(order);
            return ResponseData.SUCCESS;
        }
        return ResponseData.FAIL;
    }
    @RequestMapping("getOrderNo")
    public String getOrderNo(){
        return new String(RandomUtil.getRandomOrderNo()+System.currentTimeMillis()).substring(0,13);
    }
}
